<?php
class MenuWidget extends Widget{

	public function render($data){
		/**
		 * cms_cate ,cms_cate_description, cate_id 	language_id 	cate_name 
		 *  cms_program_cate,cms_program_cate_description
		 *  parent_id 	cate_image 	sort_order 	status 	date_added 	last_modified 
		 */
		S('header_menu',null);
		if(S('header_menu')){
			$data  = S('header_menu');
		}else{			
			$Conferences = M()->query('select cd.cate_name,c.cate_id from cms_cate c join cms_cate_description cd on c.cate_id = cd.cate_id
						where cd.language_id = '.L('lan_id').' and  c.status = 1 and c.parent_id = 1
						order by c.sort_order desc , cd.cate_name asc');
			$Lectures  = M()->query('select cd.cate_name,c.cate_id from cms_cate c join cms_cate_description cd on c.cate_id = cd.cate_id
						where cd.language_id = '.L('lan_id').' and  c.status = 1 and c.parent_id = 2
						order by c.sort_order desc , cd.cate_name asc');	
			$Researchs  = M()->query('select cd.cate_name,c.cate_id from cms_program_cate c join cms_program_cate_description cd on c.cate_id = cd.cate_id
						where cd.language_id = '.L('lan_id').' and  c.status = 1
						order by c.sort_order desc , cd.cate_name asc');
			$Internationals =  M()->query('select cd.cate_name,c.cate_id from cms_cate c join cms_cate_description cd on c.cate_id = cd.cate_id
						where cd.language_id = '.L('lan_id').' and  c.status = 1 and c.parent_id = 3
						order by c.sort_order desc , cd.cate_name asc');
			$Aboutus = M()->query('select cd.cate_name,c.cate_id from cms_cate c join cms_cate_description cd on c.cate_id = cd.cate_id
						where cd.language_id = '.L('lan_id').' and  c.status = 1 and c.parent_id = 4
						order by c.sort_order desc , cd.cate_name asc');	
			$data['conferences']  = $Conferences;
			$data['lectures']  = $Lectures;
			$data['researchs']  = $Researchs;
			$data['internationals'] = $Internationals;
			$data['aboutuss']	= $Aboutus;
			
			S('header_menu',$data,60);
		} 
		
		return $this->renderFile('',$data);
	}
}

?>
